<template>
	<view class="waterfall">
		<view class="waterfall-list">
			<view class="waterfall-item" v-for="(item, index) in list" :key="index">
				<image :src="item" :lazy-load="true" mode="widthFix" @click="handleImg(item)"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "waterFallBycss",
		data() {
			return {

			};
		},
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		methods: {
			handleImg(item) {
				uni.previewImage({
					urls: this.list,
					current: item
				})
			}
		}
	}
</script>

<style lang="scss">
	.waterfall {
		padding: 22rpx;

		margin-bottom: 100rpx;

		.waterfall-list {
			column-count: 2;
			column-gap: 20rpx;
		}

		.waterfall-item {
			width: 100%;
			box-sizing: border-box;
			overflow: hidden;
			break-inside: avoid;
			/*避免在元素内部插入分页符*/
			box-sizing: border-box;
			margin-bottom: 20rpx;

			image {
				width: 100%;
			}
		}
	}
</style>